﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LaoLuo
{
    public class SizedIList<T, TContainer> : SizedCollection<T, TContainer>
        where TContainer : IList<T>, new()
    {
        /// <summary>
        /// init a <see cref="SizedIList&lt;T, TContainer>"/>
        /// </summary>
        /// <param name="size">fixed-size of this list</param>
        /// <param name="items">elements to fill</param>
        public SizedIList(int size, params T[] items)
            : base(size, items.AsEnumerable())
        {

        }

        /// <summary>
        /// init a <see cref="SizedIList&lt;T, TContainer>"/>
        /// </summary>
        /// <param name="size">fixed-size of this list</param>
        /// <param name="items">elements to fill</param>
        public SizedIList(int size, IEnumerable<T> items = null)
            : base(size, items)
        {

        }

        protected override void Truncate()
        {
            //_container.RemoveAt(_container.Count - 1);
            Container.RemoveAt(0);
        }

        protected override bool Reversed
        {
            get { return true; }
        }
    }
}
